package utils;

public enum Operation {
    PLUS{

        @Override
        public double eval(double x, double y) {
            return x + y;
        }

    },
    MINUS{

        @Override
        public double eval(double x, double y) {
            return x - y;
        }

    },
    TIMES{

        @Override
        public double eval(double x, double y) {
            return x * y;
        }

    },
    DIVIDE{

        @Override
        public double eval(double x, double y) {
            return x / y;
        }

    };

    /**
     * 抽象方法，由不同的枚举值提供不同的实现。
     * @param x
     * @param y
     * @return
     */
    public abstract double eval(double x, double y);

}
